using System;
using System.Collections.Generic;
using System.Text;

namespace Objects
{
   public class DangKy
    {
        #region DangKy variables

        private int _Id;

        private DateTime _NgayDangKy;
        private DateTime _NgayHetHan;
        private DateTime _NgayNhanThe;

        private int _Status;
        private int _SapXep;
       private String _MaThanhToan;
       private String _GhiChu;

        private int _IdKhachHang;
        private int _IdKhachHangNhanThe;
        private int _IdKhachHangNhanTheKhac;
        private int _IdLoaiThe;
        private int _IdMauThe;
        private int _IdPhuongThucThanhToan;
        private int _IdChiNhanh;
        private int _IdMenhGia;
        private int _IdMenhGiaKhac;
       private int _SoLuong;


        #endregion

        #region DangKy properties

        public int Id
        {
            get { return _Id; }
            set { _Id = value; }
        }

        public DateTime NgayDangKy
        {
            get { return _NgayDangKy; }
            set { _NgayDangKy = value; }
        }

        public DateTime NgayHetHan
        {
            get { return _NgayHetHan; }
            set { _NgayHetHan = value; }
        }

       public DateTime NgayNhanThe
       {
           get { return _NgayNhanThe; }
           set { _NgayNhanThe = value; }
       }

       public String MaThanhToan
       {
           get { return _MaThanhToan; }
           set { _MaThanhToan = value; }
       }

       
        public String GhiChu
        {
            get { return _GhiChu; }
            set { _GhiChu = value; }
        }

        public int Status
        {
            get { return _Status; }
            set { _Status = value; }
        }

        public int SapXep
        {
            get { return _SapXep; }
            set { _SapXep = value; }
        }

        public int IdKhachHang
        {
            get { return _IdKhachHang; }
            set { _IdKhachHang = value; }
        }

        public int IdKhachHangNhanThe
        {
            get { return _IdKhachHangNhanThe; }
            set { _IdKhachHangNhanThe = value; }
        }

       public int IdLoaiThe
       {
           get { return _IdLoaiThe; }
           set { _IdLoaiThe = value; }
       }

        public int IdMauThe
        {
            get { return _IdMauThe; }
            set { _IdMauThe = value; }
        }

        public int IdKhachHangNhanTheKhac
        {
            get { return _IdKhachHangNhanTheKhac; }
            set { _IdKhachHangNhanTheKhac = value; }
        }
      
        public int IdPhuongThucThanhToan
       {
           get { return _IdPhuongThucThanhToan; }
           set { _IdPhuongThucThanhToan = value; }
        }

        public int IdChiNhanh
        {
            get { return _IdChiNhanh; }
            set { _IdChiNhanh = value; }
        }

        public int IdMenhGia
        {
            get { return _IdMenhGia; }
            set { _IdMenhGia = value; }
        }

       public int IdMenhGiaKhac
        {
            get { return _IdMenhGiaKhac; }
            set { _IdMenhGiaKhac = value; }
        }
       public int SoLuong
       {
           get { return _SoLuong; }
           set { _SoLuong = value; }
       }


        #endregion

        #region IPopulatable<DangKy> Members

        public DangKy Populate(System.Data.DataRow reader)
        {
            DangKy item = new DangKy();

            try { item.Id = Convert.ToInt32(reader["Id"].ToString()); }
            catch { item.Id = -1; }

          
            item.NgayDangKy = Convert.ToDateTime(reader["NgayDangKy"].ToString());
            item.NgayHetHan = Convert.ToDateTime(reader["NgayHetHan"].ToString());
            item.NgayNhanThe = Convert.ToDateTime(reader["NgayNhanThe"].ToString());

            try
            {
                item.MaThanhToan = Convert.ToString(reader["MaThanhToan"].ToString());
            }
            catch { item.MaThanhToan = ""; }

            item.GhiChu = Convert.ToString(reader["GhiChu"].ToString());

            item.Status = Convert.ToInt32(reader["Status"].ToString());
            item.SapXep = Convert.ToInt32(reader["SapXep"].ToString());

            try { item.IdKhachHang = Convert.ToInt32(reader["IdKhachHang"].ToString()); }
            catch { item.IdKhachHang = -1; }

            try { item.IdKhachHangNhanThe = Convert.ToInt32(reader["IdKhachHangNhanThe"].ToString()); }
            catch { item.IdKhachHangNhanThe = -1; }

            try { item.IdLoaiThe = Convert.ToInt32(reader["IdLoaiThe"].ToString()); }
            catch { item.IdLoaiThe = -1; }

            try { item.IdKhachHangNhanTheKhac = Convert.ToInt32(reader["IdKhachHangNhanTheKhac"].ToString()); }
            catch { item.IdKhachHangNhanTheKhac = -1; }

            try { item.IdMauThe = Convert.ToInt32(reader["IdMauThe"].ToString()); }
            catch { item.IdMauThe = -1; }

            try { item.IdChiNhanh = Convert.ToInt32(reader["IdChiNhanh"].ToString()); }
            catch { item.IdChiNhanh = -1; }

            try { item.IdPhuongThucThanhToan = Convert.ToInt32(reader["IdPhuongThucThanhToan"].ToString()); }
            catch { item.IdPhuongThucThanhToan = -1; }

            try { item.IdMenhGia = Convert.ToInt32(reader["IdMenhGia"].ToString()); }
            catch { item.IdMenhGia = -1; }

            try { item.IdMenhGiaKhac = Convert.ToInt32(reader["IdMenhGiaKhac"].ToString()); }
            catch { item.IdMenhGiaKhac = -1; }

            try { item.SoLuong = Convert.ToInt32(reader["SoLuong"].ToString()); }
            catch { item.SoLuong = -1; }
           
            return item;
        }

        #endregion
    }
}
